<template>
  <div>
    <h4>HelloWorld</h4>
    <p>鼠标的位置为：({{ x }}, {{ y }})</p>
  </div>
</template>

<script>
// 引入拆分出去的 hook(组合式函数)
import useMouse from '../hooks/useMouse'
import useEventListener from '../hooks/useEventListener'

useEventListener(window, 'click', () => {
  console.log('点击了')
})

export default {
  setup() {
    const { x, y } = useMouse()

    return {
      x,
      y
    }
  }
}
</script>
